
#######################################################################################################################
#                                            Replication Materials for                                                #                   
#     "How Farmers Weigh Solar Adoption: Identifying Distinct Evaluation Styles Among U.S. Agricultural Producers"    #
#######################################################################################################################

This directory includes the data and code needed to replicate all tables and figures included in 
"How Farmers Weigh Solar Adoption: Identifying Distinct Evaluation Styles Among U.S. Agricultural Producers".

##################
#     Folders    #
##################

appendix/        Appendix figures and tables  
data_derived/    Cleaned and imputed analytic datasets (generated by scripts)  
data_raw/        Original, unmodified datasets  
figures/         All manuscript figures  
scripts/         All replication scripts  
tables/          All manuscript tables  
README.txt       This file  

##################
#      Data      #
##################

1. survey_data_raw.csv  
   Raw survey dataset used in all analyses.

2. coa_2022_va.csv  
   2022 Census of Agriculture (Virginia) data.

3. variable_dictionary.csv  
   Variable codebook describing survey variables and coding.

**Important:** All main analyses are conducted on the **MICE-imputed datasets**, not the raw survey data.  
The raw data is used only for cleaning and imputation. The imputed datasets incorporate missing-data uncertainty 
and are saved in `data_derived/` as:

- `survey_imputed.csv` — Complete dataset from the first imputation  
- `survey_imputed_all_sets.csv` — Long-format dataset including all imputations  
- `mice_imputation_object.rds` — Full MICE object for replication or further analysis  

##################
#     Scripts    #
##################

All scripts are located in the scripts/ folder.

00_master_replication.R  
    Master script that runs all replication files in the correct order.

01_clean_data.R  
    Cleans raw survey data, performs multiple imputation, and exports analytic datasets 
    to the data_derived/ folder.

02_main_analysis.R  
    Estimates all primary statistical models reported in the manuscript using the imputed datasets.

03_figures.R  
    Reproduces all manuscript figures and saves them to the figures/ folder.

04_tables.R  
    Reproduces all manuscript tables and saves them to the tables/ folder.

05_appendix.R  
    Generates all appendix figures and tables and runs additional robustness analyses.  
    **Note on survey responses:** Some mail respondents selected more than three items despite instructions.  
    We retained all endorsements rather than truncating responses to preserve respondent information.  
    Three robustness specifications with varying data treatment and over-selection handling are implemented here,  
    producing substantively consistent results. All appendix outputs are saved to the appendix/ folder.

##################
#  Instructions  #
##################

To fully replicate all results:

1. Open the project from the top-level replication directory.
2. Run: scripts/00_master_replication.R

This will:

- Clean and prepare the data  
- Perform multiple imputation  
- Estimate all models on the imputed datasets  
- Generate all manuscript figures and tables  
- Generate all appendix materials  

Notes:

- Raw data remain unmodified in `data_raw/`.  
- All derived and imputed datasets are stored in `data_derived/`.  
- Figures and tables are automatically written to their respective folders.  
- All scripts use relative paths and should be run from the top-level directory.